"""
截图：
    带世界戳的命名
"""
import os
from datetime import datetime
from time import sleep
from selenium import webdriver

driver = webdriver.Edge()

driver.get("http://www.zlcode.top")

sleep(2)

# 配置截图目录
screenshot_dir = "screenshots"
os.makedirs(screenshot_dir, exist_ok=True)
# 生成带时间戳的文件名
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
filename = os.path.join(screenshot_dir, f"screenshot_{timestamp}.png")

driver.save_screenshot(filename)
print(f"截图已保存至“{filename}")

driver.quit()
